package com.itheima.dao;

import com.itheima.domain.Book;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * ClassName: BookDao
 * Package: com.itheima.dao
 * Description:
 *
 * @Auther gongkaiming
 * @Create 2024/11/28 21:30
 * @Version 1.0
 */
public interface BookDao {

    @Insert("insert into tbl_book (type, name, description) values (#{type}, #{name}, #{description})")
    public void save(Book book);

    @Update("update tbl_booke set type = #{type}, name = #{name}, description=#{description} where id = #{id}")
    public void update(Book book);

    @Delete("delete from tbl_book where id = #{id}")
    public void delete(Integer id);

    @Select("select * from tbl_book where id = #{id}")
    public Book getById(Integer id);

    @Select("select * from tbl_book")
    public List<Book> getAll();
}
